# -*- coding: utf-8 -*-

# Scrapy settings for torrent_crawler project
#
# For simplicity, this file contains only the most important settings by
# default. All the other settings are documented here:
#
#     http://doc.scrapy.org/en/latest/topics/settings.html
#

BOT_NAME = 'torrent_crawler'

SPIDER_MODULES = ['torrent_crawler.spiders']
NEWSPIDER_MODULE = 'torrent_crawler.spiders'

USER_AGENT = 'torrent_crawler (+http://www.yourdomain.com)'

DOWNLOADER_MIDDLEWARES = {
    'torrent_crawler.middlewares.PBBannedRetryMiddleware': 999,
}

ITEM_PIPELINES = {
    'torrent_crawler.pipelines.TorrentNameTokenizePipeline': 50,
    #'torrent_crawler.pipelines.MySQLStorePipeline': 100
    'torrent_crawler.pipelines.ElasticSearchPipeline': 100
}

DOWNLOAD_DELAY = 1

MYSQL_HOST = '127.0.0.1'
MYSQL_DBNAME = 'torrents'
MYSQL_USER = 'root'
MYSQL_PASSWD = ''

ELASTICSEARCH_SERVER = 'localhost'  # If not 'localhost' prepend 'http://'
ELASTICSEARCH_PORT = 9200  # If port 80 leave blank
ELASTICSEARCH_USERNAME = ''
ELASTICSEARCH_PASSWORD = ''
ELASTICSEARCH_INDEX = 'showtime'
ELASTICSEARCH_TYPE = 'torrents'
ELASTICSEARCH_UNIQ_KEY = 'info_hash'

#FEED_URI = 'file:///data/zhaoyao/test.json'
#FEED_FORMAT = 'jsonlines'
